#ifndef _NPC_HPP_
#define	_NPC_HPP_
/*******************************************************************************
 ** Government Sanctioned Espionage RPG                                       **
 ** http://www.government-sanctioned.us/                                      **
 **===========================================================================**
 ** Name: npc.hpp                                                             **
 ** Description: Support for NPCs                                             **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved License                             **
 **                                                                           **
 ** The contents of this file are subject to the terms of the                 **
 ** Common Development and Distribution License, Version 1.0 only             **
 ** (the "License").  You may not use this file except in compliance          **
 ** with the License.                                                         **
 **                                                                           **
 ** You can find a copy of the license in the LICENSE file within             **
 ** this distribution or at $WIKI/display/GOVT/License-software.              **
 ** Software distributed under the License is distributed on an "AS IS"       **
 ** basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.           **
 ** See the License for the specific language governing permissions           **
 ** and limitations under the License.                                        **
 **                                                                           **
 ** When distributing Covered Code, include this CDDL header in each          **
 ** file and include the License file at $GAME_DIR/LICENSE.                   **
 ** If applicable, add the following below this header, with the indicated    **
 ** fields enclosed by brackets "[]" replaced with your own identifying       **
 ** information: Portions Copyright [yyyy] [name of copyright owner]          **
 **                                                                           **
 ** Copyright (c) 2009-2012  Barry Gian James <gian@gamingods.net>            **
 ** All rights reserved.                                                      **
 ******************************************************************************/

// Created on April 3, 2010, 6:57 PM
// Modified $Date$ by $Author$

#define NPC_hpp_ID   "$Id$"

#include "character.hpp"
//#include "program.hpp"

#define DEFAULT_NPC_AMMO_MAGS	3

// Type of available contacts
enum class ContactType {
	None, Professional, Government, Intelligence, Police,
	Military, Street, Crime
};

enum class NPCType { Human, Animal, Outlander, Swarm };

// TODO Make these flag types starting 0x00000001
enum class NPCQualityType : uint64_t  {
	AllThumbs = 0x0000000000000001, AltID = 0x0000000000000002, AttackOnCmd = 0x0000000000000004,
	Augmented = 0x0000000000000008, Burrow = 0x0000000000000010, Camo = 0x0000000000000020,
	Captivating = 0x0000000000000040, CarryOnCmd = 0x0000000000000080, ClassAbility = 0x0000000000000100,
	Clumsy = 0x0000000000000200, Commander = 0x0000000000000400, Construct = 0x0000000000000800,
	DmgReduction = 0x0000000000001000,DmgResistance = 0x0000000000002000, DisarmOnCmd = 0x0000000000004000,
	Diurnal = 0x0000000000008000, EntertainOnCmd = 0x0000000000010000, ExtendedTraining = 0x0000000000020000,
	FastHealing = 0x0000000000040000, Fearless = 0x0000000000080000, Fearsome = 0x0000000000100000,
	Feat = 0x0000000000200000, Feral = 0x0000000000400000, Fleet = 0x0000000000800000, Flight = 0x0000000001000000,
	Foil = 0x0000000002000000, GuardOnCmd = 0x0000000004000000, Henchman = 0x0000000008000000,
	Horde = 0x0000000010000000, Horrific = 0x0000000020000000, Hulking = 0x0000000040000000,
	ImpHearing = 0x0000000080000000, ImpVision = 0x0000000100000000,
	ImpScent = 0x0000000200000000, InferiorAttr = 0x0000000400000000, LowLight = 0x0000000800000000,
	Mastermind = 0x0000001000000000, Meek = 0x0000002000000000, Minion = 0x0000004000000000, Mount = 0x0000008000000000,
	NaturalAttack = 0x0000010000000000, Nocturnal = 0x0000020000000000, NonCombatant = 0x0000040000000000,
	OpenDoorOnCmd = 0x0000080000000000, Prodigy = 0x0000100000000000,
	Rescue = 0x0000200000000000, RetrieveOnCmd = 0x0000400000000000, Seductive = 0x0000800000000000,
	SeekOnCmd = 0x0001000000000000, Skilled = 0x0000200000000000, Sluggish = 0x0000400000000000,
	Specialty = 0x0000800000000000, SquadItem = 0x0001000000000000, SquadWpn = 0x0002000000000000,
	Stalwart = 0x0004000000000000, PlotCritical = 0x0008000000000000, StrongMinded = 0x0010000000000000,
	StrongWilled = 0x0020000000000000, SubdueOnCmd = 0x0040000000000000, SuperiorAttr = 0x0080000000000000,
	Talented = 0x0100000000000000, Tough = 0x0200000000000000, Treacherous = 0x0400000000000000,
	Undersized = 0x0800000000000000, Unnerving = 0x1000000000000000,
	max
};
extern const char * NPCQualityTypeStr[];
extern const char * NPCGradeStr[];
extern const char * NPCDispositionStr[];
extern const char * NPCTraitStr[10][100];

//struct NPCQuality
//{
//	NPCQualityType	type;
//	stat::StatMod	mod;
//	uint8_t			xpmod;
//	NPCQuality *	next;
//};

enum class NPCDisposition {
	Helpful, Supportive, Friendly, Intrigued, Neutral, Aloof,
	Unfriendly, Hostile, Adversarial,
	max
};

enum class NaturalAttackType {
	Bite, Claw, Tail, Trample, Unarmed,
	max
};

#define NPC_GRADE	0
#define NPC_THREAT	1
//! Scalable NPC statistics with ability to extend or collapse
//! to any given threat level and difficulty.  Inspiration and
//! data from Spycraft 2.0 (c) AEG, Inc and FantasyCraft 1.0.
struct NPCStatistics
{
	static int	initBonus[10][200];
	static int	attackBonus[10][200];
	static int 	defenseBonus[10][200];
	static int	resilienceBonus[10][200];
	static int	dmgSaveBonus[10][200];
	static int	vitalityPoints[10][200];
	static int	woundPoints[10][200];
	static int	competenceBonus[10][200];
	static int	skillBonus[10][200];
};

// NPC Flags
#define NPC_UNIQUE	0x0001

//! @class NPC
//! @brief the definition and behavior for npcs
#pragma db object table("npcs")
class NPC : public Character
{
public:
	NPC();
	NPC(const std::string & n, const std::string & t);
	NPC(const NPC &);
	~NPC();

	void	accept(Pattern::Visitor & v);

	std::string		Program() { return prog; }
	void			Program(std::string & p) { prog = p; }
	ContactType		contactType() { return ctype; }
	void			contactType(ContactType c) { ctype = c; }
	NPCType			npcType() { return npctype; }
	void			npcType(NPCType n) { npctype = n; }
	uint64_t		Flags() { return flags; }
	void			Flags(uint64_t f) { flags |= f; }
	void			ZeroFlags() { flags = 0; }

private:
	friend class odb::access;

	std::string		prog;	// the script that defines the NPC's behavior
	ContactType		ctype;
	NPCType			npctype;
	uint64_t		flags;
};




// A special instance of an NPC
// We treat shopkeepers as a special case since they're so important
//class Room;
//class ShopKeeper : public NPC
//{
//public:
//
//protected:
//	Room *	shop;
//};


#endif	/* _NPC_HPP_ */

